package src.com.doit.demo;

public class test {
    public static void main(String[] args) {
        Home home = new Home();
        home.eatAtHome(new Cat());//接口 主要就是封装方法
        home.eatAtHome(new Dog());

        animalEat(new Cat());
        animalEat(new Dog());

        Animal cat = new Cat();//多态,向上转型 体现多态的扩展性和便利
        cat.eat();

        Cat c= (Cat)cat;//多态,向下转型 调用Cat类的特有方法
        c.eat();

        kanjia(new Dog());

        Home h = new Home();
        home.kanjia(new Dog());

    }
    public static void animalEat(Animal animal)
    {
        animal.eat();
    }
    public static void kanjia(lookHome lk) {
        System.out.println("看家了");
        lk.lookDoor();
    }
}
